package com.hou.controller;

import com.hou.parma.JParam;
import com.hou.pojo.*;
import com.hou.service.*;
import com.hzk.vo.RespBean;
import com.hzk.vo.RespBeanEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @auoter:jackh
 */
@RestController
@Controller
public class jlistController {
    @Autowired
    IGoodsJlistService iGoodsJlistService;
    @Autowired
    IOrderJlistService iOrderJlistService;
    @Autowired
    IUserJlistService iUserJlistService;
    @Autowired
    IAppJlistService iAppJlistService;
    @Autowired
    IVipJlistService iVipJlistService;

    @RequestMapping("/meuns")
    public RespBean re() {
        List arrayList5 = new ArrayList();
        JParam child = new JParam();
        child.setId(2);
        child.setTitle("管理员列表");
        child.setPath("/vip/select");
        List<JParam> list=new ArrayList<>();
        JParam jParam = new JParam();
        jParam.setId(1);
        jParam.setPath("/hou");
        jParam.setTitle("管理员管理");//管理员对象
        ArrayList arrayList = new ArrayList();
        arrayList.add(child);
        jParam.setChildren(arrayList);



        JParam child2 = new JParam();
        child2.setId(4);
        child2.setPath("/sekillg/select");
        child2.setTitle("秒杀产品列表");
        JParam child3 = new JParam();
        child3.setId(5);
        child3.setPath("/taomi/select");
        child3.setTitle("积分产品列表");
        ArrayList arrayList1 = new ArrayList();
        arrayList1.add(child2);
        arrayList1.add(child3);
        JParam jParam1 = new JParam();
        jParam1.setId(3);
        jParam1.setPath("/hou");
        jParam1.setTitle("产品管理");
        jParam1.setChildren(arrayList1);

        JParam child4 = new JParam();
        child4.setId(7);
        child4.setTitle("用户列表");
        child4.setPath("/user/select");
        ArrayList arrayList2 = new ArrayList();
        arrayList2.add(child4);
        JParam jParam2 = new JParam();
        jParam2.setTitle("用户管理");
        jParam2.setId(6);
        jParam2.setPath("/hou");
        jParam2.setChildren(arrayList2);


        JParam child5 = new JParam();
        child5.setId(9);
        child5.setTitle("初筛列表");
        child5.setPath("/app/select");
        ArrayList arrayList3 = new ArrayList();
        arrayList3.add(child5);
        JParam jParam3 = new JParam();
        jParam3.setTitle("初筛管理");
        jParam3.setId(8);
        jParam3.setPath("/hou");
        jParam3.setChildren(arrayList3);


        JParam child6 = new JParam();
        child6.setId(10);
        child6.setTitle("订单列表");
        child6.setPath("/order/select");
        ArrayList arrayList4 = new ArrayList();
        arrayList4.add(child6);
        JParam jParam4 = new JParam();
        jParam4.setTitle("订单管理");
        jParam4.setId(9);
        jParam4.setPath("/hou");
        jParam4.setChildren(arrayList4);


        JParam child7 = new JParam();
        child7.setId(11);
        child7.setTitle("银行账户列表");
        child7.setPath("/bank/select");
        ArrayList arrayList6 = new ArrayList();
        arrayList6.add(child7);
        JParam jParam5 = new JParam();
        jParam5.setTitle("银行账户管理");
        jParam5.setId(10);
        jParam5.setPath("/hou");
        jParam5.setChildren(arrayList6);
        arrayList5.add(jParam);
        arrayList5.add(jParam1);
        arrayList5.add(jParam2);
        arrayList5.add(jParam3);
        arrayList5.add(jParam4);
        arrayList5.add(jParam5);



        return RespBean.success(arrayList5);
    }

    @RequestMapping("/user")
    public RespBean user() {
        List<UserJlist> select = iUserJlistService.select();
        if (select==null){
            return RespBean.error(RespBeanEnum.NULL_LIST_ERROR);
        }
        return RespBean.success(select);
    }

    @RequestMapping("/order")
    public RespBean order() {
        List<OrderJlist> select = iOrderJlistService.select();
        if (select==null){
            return RespBean.error(RespBeanEnum.NULL_LIST_ERROR);
        }
        return RespBean.success(select);
    }

    @RequestMapping("/goods")
    public RespBean goods() {
        List<GoodsJlist> select = iGoodsJlistService.select();
        if (select==null){
            return RespBean.error(RespBeanEnum.NULL_LIST_ERROR);
        }
        return RespBean.success(select);
    }

    @RequestMapping("/app")
    public RespBean app() {
        List<AppJlist> select = iAppJlistService.select();
        if (select==null){
            return RespBean.error(RespBeanEnum.NULL_LIST_ERROR);
        }
        return RespBean.success(select);
    }
}
